import request from '@/utils/request'

interface ResponseData {
  list: [],
  totalPage: 0,
  total: 0,
  pageNum: number
}

// 品牌相关接口

/**
 * 查询所有品牌
 * @param params
 * @returns
 */
export const brandQueryAll = <T>(data?: any) =>
  request.post<T>('/admin-core/web/brand/v1/queryAllList', data)

/**
 * 查询分页品牌
 * @param params
 * @returns
 */
export const brandQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/brand/v1/queryPage', data)

/**
 * 删除品牌
 * @param params
 * @returns
 */
export const removeBrand = <T>(data?: any) =>
  request.post<T>('/admin-core/web/brand/v1/remove', data)

/**
 * 保存品牌
 * @param params
 * @returns
 */
export const saveBrand = <T>(data?: any) =>
  request.post<T>('/admin-core/web/brand/v1/save', data)

/**
 * 更新品牌
 * @param params
 * @returns
 */
export const updateBrand = <T>(data?: any) =>
  request.post<T>('/admin-core/web/brand/v1/update', data)

// 车型相关接口
/**
 * 查询分页车型
 * @param params
 * @returns
 */
export const modelQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/model/v1/queryPage', data)

/**
 * 删除车型
 * @param params
 * @returns
 */
export const removeModel = <T>(data?: any) =>
  request.post<T>('/admin-core/web/model/v1/remove', data)

/**
 * 保存车型
 * @param params
 * @returns
 */
export const saveModel = <T>(data?: any) =>
  request.post<T>('/admin-core/web/model/v1/save', data)

/**
 * 根据车系id查询车辆车型
 * @param params
 * @returns
 */
export const selectListBySeriesUuid = <T>(data?: any) =>
  request.post<T>('/admin-core/web/model/v1/selectListBySeriesUuid', data)

/**
 * 更新车型
 * @param params
 * @returns
 */
export const updateModel = <T>(data?: any) =>
  request.post<T>('/admin-core/web/model/v1/update', data)

// 车系相关接口
/**
 * 查询分页车系
 * @param params
 * @returns
 */
export const seriesQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/series/v1/queryPage', data)

/**
 * 删除车系
 * @param params
 * @returns
 */
export const removeSeries = <T>(data?: any) =>
  request.post<T>('/admin-core/web/series/v1/remove', data)

/**
 * 保存车系
 * @param params
 * @returns
 */
export const saveSeries = <T>(data?: any) =>
  request.post<T>('/admin-core/web/series/v1/save', data)

/**
 * 根据品牌id查询车辆车系
 * @param params
 * @returns
 */
export const selectListByBrandUuid = <T>(data?: any) =>
  request.post<T>('/admin-core/web/series/v1/selectListByBrandUuid', data)

/**
 * 更新车系
 * @param params
 * @returns
 */
export const updateSeries = <T>(data?: any) =>
  request.post<T>('/admin-core/web/series/v1/update', data)


// 车辆相关接口
/**
 * 查询分页车辆
 * @param params
 * @returns
 */
export const carQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/car/v1/queryPage', data)

/**
 * 删除车辆
 * @param params
 * @returns
 */
export const removeCar = <T>(data?: any) =>
  request.post<T>('/admin-core/web/car/v1/remove', data)

/**
 * 保存车辆
 * @param params
 * @returns
 */
export const saveCar = <T>(data?: any) =>
  request.post<T>('/admin-core/web/car/v1/save', data)

/**
 * 更新车辆
 * @param params
 * @returns
 */
export const updateCar = <T>(data?: any) =>
  request.post<T>('/admin-core/web/car/v1/update', data)


/**
 * 导入车辆
 * @param params
 * @returns
 */
export const importModel = <T>(data?: any) =>
  request.post<T>('/admin-core/web/model/v1/import', data)

/**
 * 模版下载
 * @param params
 * @returns
 */
export const getModelTemplate = <T>() =>
  request.get<T>('/admin-core/template/车型信息导入模版.xlsx', { responseType: 'blob' })
